package com.cakin.javademo;

/**
 * @ClassName: TestDemo3
 * @Description: TODO
 * @Date: 2020/6/13
 * @Author: cakin
 */
public class TestDemo3 {
    public static void main(String[] args) {
        int a , b;
        a = 10;
        b = (a == 1) ? 20 : 30;  // 30
        System.out.println( "Value of b is : " +  b );

        b = (a == 10) ? 20 : 30;  //20
        System.out.println( "Value of b is : " + b );

        String name = "James";
        boolean result = name instanceof String;
        System.out.println(result);
    }
}

class Vehicle {}

class Car extends Vehicle {
    public static void main(String[] args){
        Vehicle a = new Car();
        String b = null;
        boolean result =  a instanceof Car;
        System.out.println( result);
        // 类型不匹配，编译的时候就报错了
        // boolean b1 = b instanceof Car;
    }
}
